<template>

  <div class="table-container">
    <catch-table :form-create="formCreate" v-bind="table"/>

    <!-- 详细信息 -->
    <el-dialog title="详细信息" :visible.sync="dialogVisible" width="60%" :before-close="handleClose">
      <el-descriptions border title="基本信息">
        <el-descriptions-item label="个人身份">{{ e.role_name }}</el-descriptions-item>
        <el-descriptions-item label="姓名">{{ e.realname }}</el-descriptions-item>
        <el-descriptions-item label="所在单位">{{ e.work_company }}</el-descriptions-item>
        <el-descriptions-item label="职务">{{ e.duty }}</el-descriptions-item>
        <el-descriptions-item label="出生年月日">{{ e.birthday }}</el-descriptions-item>
        <el-descriptions-item label="性别">{{ e.sex_name }}</el-descriptions-item>
        <el-descriptions-item label="学历">{{ e.xue_li }}</el-descriptions-item>
        <el-descriptions-item label="毕业院校及专业">{{ e.university }}</el-descriptions-item>
        <el-descriptions-item label="手机号码">{{ e.mobile }}</el-descriptions-item>
        <el-descriptions-item label="邮箱">{{ e.email }}</el-descriptions-item>
        <el-descriptions-item label="常住城市">{{ e.city_name }}</el-descriptions-item>
        <el-descriptions-item label="是否愿意加入智库">{{ e.join_is }}</el-descriptions-item>
        <el-descriptions-item label="加入智库可贡献">{{ e.join_gong_xian }}</el-descriptions-item>
        <el-descriptions-item label="希望通过平台获得什么">{{ e.join_why }}</el-descriptions-item>
      </el-descriptions>

      <el-descriptions border title="居间人" :column="2" style="margin-top: 30px">
        <el-descriptions-item label="居间业务">{{ e.ye_wu }}</el-descriptions-item>
      </el-descriptions>

      <el-descriptions border title="求职者" :column="2" style="margin-top: 30px">
        <el-descriptions-item label="个人专长">{{ e.job_zhuan_chang }}</el-descriptions-item>
        <el-descriptions-item label="教育经历">{{ e.job_school }}</el-descriptions-item>
        <el-descriptions-item label="工作经历">{{ e.job_history }}</el-descriptions-item>
        <el-descriptions-item label="求职意向">{{ e.job_want }}</el-descriptions-item>
        <el-descriptions-item label="专兼职">{{ e.job_type_name }}</el-descriptions-item>
        <el-descriptions-item label="期望待遇">{{ e.job_salary }}</el-descriptions-item>
        <el-descriptions-item label="自我介绍">{{ e.job_introduce }}</el-descriptions-item>
      </el-descriptions>

      <div v-if="e.company_status == 2" style="margin: 30px;">
        <el-input type="textarea" :rows="6" placeholder="备注" v-model="e.company_status_note">
        </el-input>
        <div style="display: flex;justify-content: center;margin-top: 20px">
          <el-button type="danger" @click="statusChange(e.id,4)">拒绝</el-button>
          <el-button type="primary" style="margin-left: 150px;" @click="statusChange(e.id,3)">通过</el-button>
        </div>
      </div>

    </el-dialog>
  </div>
</template>

<script>
import renderTable from '@/views/render-table-form'

export default {
  mixins: [renderTable],
  data() {
    return {
      need_audit: 1,
      company_status_note: '',
      tableFrom: '',
      e: { company_status_note: '' },
      dialogVisible: false
    }
  },
  methods: {
    beforeSubmit(row) {
      if (row.form.parent_id instanceof Array) {
        row.form.parent_id = row.form.parent_id.length > 0 ? row.form.parent_id.pop() : 0
      }
      return row
    },
    handleView(e) {
      this.e = e
      this.dialogVisible = true
    },

    statusChange(id, company_status) {
      this.$http({
        url: '/UserExt/audit',
        method: 'POST',
        data: {
          id: id,
          company_status: company_status,
          company_status_note: this.e.company_status_note
        }
      }).then(r => {
        this.dialogVisible = false
        this.$message.success('操作成功')
        this.$refs[this.table.ref].getList()
      })
    },

    zidingyi(e) {
      console.log(e)
    }
  }

}
</script>
